import { BuildPlugin } from "../@types";
import { PACKAGE_NAME } from "./global";

export const load: BuildPlugin.load = function () {
    console.debug(`${PACKAGE_NAME} load`);
};
export const unload: BuildPlugin.load = function () {
    console.debug(`${PACKAGE_NAME} unload`);
};

const complexTestItems = {
    number: {
        label: `i18n:${PACKAGE_NAME}.options.complexTestNumber`,
        description: `i18n:${PACKAGE_NAME}.options.complexTestNumber`,
        default: 80,
        render: {
            ui: "ui-num-input",
            attributes: {
                step: 1,
                min: 0,
            },
        },
    },
    string: {
        label: `i18n:${PACKAGE_NAME}.options.complexTestString`,
        description: `i18n:${PACKAGE_NAME}.options.complexTestString`,
        default: "cocos",
        render: {
            ui: "ui-input",
            attributes: {
                placeholder: `i18n:${PACKAGE_NAME}.options.enterCocos`,
            },
        },
        verifyRules: ["ruleTest"],
    },
    boolean: {
        label: `i18n:${PACKAGE_NAME}.options.complexTestBoolean`,
        description: `i18n:${PACKAGE_NAME}.options.complexTestBoolean`,
        default: true,
        render: {
            ui: "ui-checkbox",
        },
    },
};

export const configs: BuildPlugin.Configs = {
    "web-mobile": {
        hooks: "./hooks",
        doc: "editor/publish/custom-build-plugin.html",
        options: {},
        panel: "./panel",
        verifyRuleMap: {
            ruleTest: {
                message: `i18n:${PACKAGE_NAME}.options.ruleTest_msg`,
                func(val, buildOptions) {
                    if (val === "cocos") {
                        return true;
                    }
                    return false;
                },
            },
        },
    },
};

export const assetHandlers: BuildPlugin.AssetHandlers = "./asset-handlers";
